using Share;
using UnityEngine;

namespace WS.Share
{
    public class ColliderManager : SingletonMonoObject<ColliderManager>
    {

        public void DrawCircle(Vector2 center, float radius, float time, Color color)
        {
            var obj = ObjectMgr.Instance.CreateObj(UIConfig.Instance.CircleTemple, GameRootManager.Instance.GetColliderRoot());
            obj.transform.position = center;
            obj.transform.localScale = radius * Vector2.one;
            var ps = obj.AddComponent<PsActionDestruct>();
            ps.delayTime = time;
            obj.GetComponent<SpriteRenderer>().color = color;
        }
        public void DrawRect(Rect rect, float time, Color color)
        {
            var obj = ObjectMgr.Instance.CreateObj(UIConfig.Instance.RectTemple, GameRootManager.Instance.GetColliderRoot());
            obj.transform.position = rect.center;
            obj.transform.localScale = new Vector2(rect.width, rect.height);
            var ps = obj.AddComponent<PsActionDestruct>();
            ps.DoSetDelayTime(time);
            obj.GetComponent<SpriteRenderer>().color = color;
        }
    }
}